<commit_before>---
layout: post
title: Combo lazy and call-by-name into lazier Scala
categories: scala
description: Combo lazy value and call-by-name you would get lazier value to solve a cyclic reference problem.
comments: true
tags: [scala, functional programming]
image:
feature:
credit:
creditlink:
date: 2015-12-28T00:00:00+00:00
author: superching
---

#  Combo lazy and call-by-name into lazier Scala
Here it is a puzzle : A parent owns a child which owns that parent. How to get the *cyclic reference* in *immutable* way?  
Before answering it, we see how easy to program it in mutable way:
<commit_msg>change word combo to combine<commit_after>---
layout: post
title: Combine lazy and call-by-name into lazier Scala
categories: scala
description: Combining lazy value and call-by-name you would get lazier value to solve a cyclic reference problem.
comments: true
tags: [scala, functional programming]
image:
feature:
credit:
creditlink:
date: 2015-12-28T00:00:00+00:00
author: superching
---

#  Combine lazy and call-by-name into lazier Scala
Here it is a puzzle : A parent owns a child which owns that parent. How to get the *cyclic reference* in *immutable* way?  
Before answering it, we see how easy to program it in mutable way:

{'fraction_non_alphanumeric': 0.07550200803212852, 'fraction_numerical': 0.02891566265060241, 'mean_word_length': 4.5377777777777775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5443065', 'n_tokens_mistral': 406, 'n_tokens_neox': 366, 'n_words': 178}